package server.controller.userController;

import server.model.factory.ModelFactory;
import server.util.InfoUtils.Info;
import server.util.ResponseUtil;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

@WebServlet("/deleteAccount")
public class DeleteAccountServlet extends HttpServlet {
    private static final long serialVersionUID = -3851284725671952375L;

    @Override
    protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        Integer userId=(Integer) req.getAttribute("userId");
        Info info= ModelFactory.getUserModel().deleteAccount(userId);
        ResponseUtil.responseMessage(resp,info);
    }
}
